package com.cmsky.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class IndexController {
	private static String className = IndexController.class.getName();
	private Logger indexLogger = Logger.getLogger(className);
	
	@RequestMapping("/home")
	public ModelAndView home(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/home");
		indexLogger.info("<|>"+className+"<|>home<|><|><|>");
		return view;
	}
	
	@RequestMapping("/content")
	public ModelAndView content(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/content");
		indexLogger.info("<|>"+className+"<|>content<|><|><|>");
		return view;
	}
	
	@RequestMapping("/tree")
	public ModelAndView tree(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/tree");
		indexLogger.info("<|>"+className+"<|>tree<|><|><|>");
		return view;
	}
	
	@RequestMapping("/demo")
	public ModelAndView demo(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/demo");
		indexLogger.info("<|>"+className+"<|>demo<|><|><|>");
		return view;
	}
	
	@RequestMapping("/node")
	public ModelAndView node(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/node");
		indexLogger.info("<|>"+className+"<|>node<|><|><|>");
		return view;
	}
	
	@RequestMapping("/index")
	public ModelAndView index(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/index");
		indexLogger.info("<|>"+className+"<|>index<|><|><|>");
		return view;
	}
	
	@RequestMapping("/nopage")
	public ModelAndView nopage(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/404");
		indexLogger.info("<|>"+className+"<|>nopage<|><|><|>");
		return view;
	}
	
	@RequestMapping("/error")
	public ModelAndView error(HttpServletRequest request,HttpServletResponse response,Model model){
		ModelAndView view = new ModelAndView("/i/500");
		indexLogger.info("<|>"+className+"<|>error<|><|><|>");
		return view;
	}
}
